import tensorflow as tf

a = tf.random.shuffle(tf.range(10))
print(a)

print(tf.sort(a, direction='DESCENDING'))
print(tf.argsort(a, direction='DESCENDING'))

idx = tf.argsort(a)
print(idx)
print(tf.gather(a, idx))

a = tf.random.uniform([4, 4], maxval=20, dtype=tf.int32)
print(a)

result = tf.math.top_k(a, 2)
print(result)
print(result.indices)
print(result.values)


